package com.ghl.controller;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathExpressionException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ghl.dao.Yemian;
@Controller
public class LoginController {
	@Autowired
	private Yemian yemian;
	
	
	
	
	@RequestMapping(value="/a")
	@ResponseBody
	public String start() throws XPathExpressionException, ParserConfigurationException {
		//List<List<List<String>>> zhuaqu = Yemian.getList();
		final BlockingQueue<Integer> queue = new ArrayBlockingQueue<>(100);
		final Object obj = new Object();
		for(int i=1;i<=100;i++) {
			queue.add(i);
		}
		for(int i=0;i<20;i++) {
			new Thread(new Runnable() {
				
				@Override
				public void run() {
					try {
						yemian.zhuaqu(queue, obj);
					} catch (XPathExpressionException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					} catch (ParserConfigurationException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					
				}
			}).start();
		}
		
		return "success";
	}
	
}
